All "Value object" Snippets
ivo
Generate the body for a integer value object class.
<template name="ivo" value=" private $$$FIELD_NAME$; public static function fromInt (int $$$FIELD_NAME$): $TYPE$ { return new $TYPE$($$$FIELD_NAME$); } private function __construct (int $$$FIELD_NAME$) { $this->$FIELD_NAME$ = $$$FIELD_NAME$; } public function __toString (): string { return (string) $this->$FIELD_NAME$; }" description="Simple Integer Value Object" toReformat="true" toShortenFQNames="true">
<variable name="TYPE" expression="phpClassName()" defaultValue="" alwaysStopAt="false" />
<variable name="FIELD_NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>
Live template
svo
Generate the body for a string value object class.
<template name="svo" value=" private string $$$FIELD_NAME$; public static function fromString (string $$$FIELD_NAME$): $TYPE$ { return new $TYPE$($$$FIELD_NAME$); } private function __construct (string $$$FIELD_NAME$) { $this->$FIELD_NAME$ = $$$FIELD_NAME$; } public function __toString (): string { return $this->$FIELD_NAME$; }" description="Simple String Value Object" toReformat="true" toShortenFQNames="true">
<variable name="TYPE" expression="phpClassName()" defaultValue="" alwaysStopAt="false" />
<variable name="FIELD_NAME" expression="camelCase(TYPE)" defaultValue="" alwaysStopAt="false" />
<context>
<option name="PHP Class Member" value="true" />
</context>
</template>
Live template